const express = require( 'express' );

const router = express.Router();

router.get( '/add' , (req,resp) => {
    // /views/dept/add.njk
    resp.render( 'dept/add' , (err,html)=>{
        if(err){
            resp.send( '<p style="color:red">模板渲染失败</p>' );
            return ;
        }
        resp.send( html );
    });
});

router.get( '/edit' , (req,resp) => {
    // /views/dept/edit.njk
    resp.render( 'dept/edit' , (err,html)=>{
        if(err){
            console.log( err );
            resp.send( '<p style="color:red">模板渲染失败</p>' );
            return ;
        }
        resp.send( html );
    });
});


module.exports = router ;